SOURCE FILE: randNumMaker.cpp




#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std ;

extern long random(void);

/* ################################################## */
/*                         init                       */
/* ################################################## */
void init() 
{ 

       /* initialize random number generator */ 
  srand(time(0) );
//  cout << "Time is: " << time(0) << " since the epoque." << endl ;

}

/* ################################################## */
/*                         main                       */
/* ################################################## */

int main() 
{ 
  init(); 

  int numNums, LoBnd, HiBnd, modulus, i, j;

  cout << "\n\nHi there.  I can generate random integers in the closed\n" ;
  cout << "interval you stipulate.\n" ;
  cout << "\nPlease enter the number of random integers you want: ";
  cin >> numNums ;
  cout << "\nPlease enter the lower bound of the interval: ";
  cin >> LoBnd ;
  cout << "\nPlease enter the upper bound of the interval: ";
  cin >> HiBnd ;
  modulus = (HiBnd-LoBnd+1) ;

  cout << endl ;
  for (i = 0; i < numNums; i++) 
  {
    cout << rand()%modulus + LoBnd << endl ;
  }

  cout << endl ;
  cout << endl ;
  cout << "Have a nice day." << endl << endl ;

  return 0 ;
}